#pragma once

#include "Event.h"
#include <sstream>

namespace Hazal
{
	class HZ_DLL_OPTION CKeyEvent : public CEvent
	{
	public:
		inline int GetKeyCode() const { return m_nKeyCode; }

		EVEMT_CLASS_CATEGORY(E_EVENT_CATEGORY::E_EVENT_CAT_KEYBOARD | E_EVENT_CATEGORY::E_EVENT_CAT_INPUT)

	protected:
		CKeyEvent(int nKeyCode) : m_nKeyCode(nKeyCode){}

		int m_nKeyCode;
	};

	class HZ_DLL_OPTION CKeyPressedEvent : public CKeyEvent
	{
		EVENT_CLASS_TYPE(E_EVENT_KEY_PRESSED)

	public:
		CKeyPressedEvent(int nKeyCode, int nRepeatCount) : 
			CKeyEvent(nKeyCode) , m_nRepeatCount(nRepeatCount) {}

	public:
		inline int GetRepeatCount() const { return m_nRepeatCount; }

		std::string ToString() const override
		{
			std::stringstream ss;
			ss << "KeyPressedEvent: " << m_nKeyCode << " (" << m_nRepeatCount << " repeates)";

			return ss.str();
		}

	private:
		int m_nRepeatCount;
	};

	class HZ_DLL_OPTION CKeyReleasedEvent : public CKeyEvent
	{
		EVENT_CLASS_TYPE(E_EVENT_KEY_RELEASED)

	public:
		CKeyReleasedEvent(int nKeyCode) : CKeyEvent(nKeyCode) {}

	public:
		std::string ToString() const override
		{
			std::stringstream ss;
			ss << "KeyReleasedEvent: " << m_nKeyCode;

			return ss.str();
		}
	};

	class HZ_DLL_OPTION CKeyTypedEvent : public CKeyEvent
	{
		EVENT_CLASS_TYPE(E_EVENT_KEY_TYPED)

	public:
		CKeyTypedEvent(int nKeyCode) : CKeyEvent(nKeyCode) {}

	public:
		std::string ToString() const override
		{
			std::stringstream ss;
			ss << "KeyTypedEvent: " << m_nKeyCode;

			return ss.str();
		}
	};
}